﻿
Public Class query
    Public Const user As String = "usr"
    Public Const site As String = "st"
    Public Const userSiteRandomKey As String = "usrk"
    Public Const cookies As String = "ck"
End Class

Public Class cookie
    Public Const user As String = "usr"
    Public Const site As String = "st"
    Public Const userSiteRandomKey As String = "usrk"
End Class

Public Class path
    Public Const userGet As String = "usrget"
    Public Const siteGet As String = "stget"
    Public Const userSet As String = "usrset"
    Public Const siteSet As String = "stset"
    Public Const userSetUI As String = "usrsetui"
    Public Const userGetUI As String = emptyString
End Class

Public Class storoomkey
    'leave pathSeperator in public to let onlinecookie2 verify it's the same as storoomc.directorystore
    Public Const pathSeperator As Char = network.pathSeperator

    Private Class storoomPrefix
        Public Const onlinecookie As String = "onlinecookie"
        Public Const cookies As String = "cookies"
    End Class

    Private Shared Function generate(ByVal prefix As String, ByVal key As String) As String
        Return prefix + pathSeperator + key
    End Function

    Public Shared Function userCookiesDirectory(ByVal id As String) As String
        Return generate(storoomPrefix.onlinecookie + character.dot + storoomPrefix.cookies, id)
    End Function
End Class

Public Class response
    Public Class statusCode
        Public Const success As Int32 = Net.HttpStatusCode.OK
        Public Const noUserInput As Int32 = Net.HttpStatusCode.BadRequest
        Public Const noSiteInput As Int32 = Net.HttpStatusCode.BadRequest
        Public Const noOnlineCookieUserSiteRandomKeyInput As Int32 = Net.HttpStatusCode.BadRequest
        Public Const invalidSiteInput As Int32 = Net.HttpStatusCode.PreconditionFailed
        Public Const onlineCookieUserSiteRandomKeyError As Int32 = Net.HttpStatusCode.Unauthorized
        Public Const internalError As Int32 = Net.HttpStatusCode.InternalServerError
    End Class

    Public Class description
        Public Const success As String = "OK"
        Public Const noUserInput As String = "NO USER INPUT"
        Public Const noSiteInput As String = "NO SITE INPUT"
        Public Const noOnlineCookieUserSiteRandomKeyInput As String = "NO ONLINECOOKIE USERSITERANDOMKEY INPUT"
        Public Const invalidSiteInput As String = "INVALID SITE INPUT"
        Public Const onlineCookieUserSiteRandomKeyError As String = "ONLINECOOKIE USERSITERANDOMKEY ERROR"
        Public Const internalError As String = "INTERNAL ERROR"
    End Class
End Class

Public Class getResponse
    Public Class statusCode
        Public Const noCookiesFound As Int32 = Net.HttpStatusCode.NotFound
    End Class

    Public Class description
        Public Const noCookiesFound As String = "NO COOKIES FOUND"
    End Class
End Class

Public Class setResponse
    Public Class statusCode
        Public Const noCookiesInput As Int32 = Net.HttpStatusCode.BadRequest
    End Class

    Public Class description
        Public Const noCookiesInput As String = "NO COOKIES INPUT"
    End Class
End Class

Public Class contentNaming
    Public Const sharedCookies As String = "sharedcookies"
    Public Const site As String = "site"
    Public Const siteCookies As String = "sitecookies"
End Class

Public Module _occommon
    Public Const sharedCookieSite As String = "share"
    Public Const contentNameValueSeparator As String = network.headerNameValueSeparator + character.equalSign
    Public Const contentNameValueSeparatorReplacement As Char = character.underline
    Public Const contentSeparator As String = character.return + character.newline
    Public Const contentSeparator2 As Char = character.newline
    Public Const cookieSeparator As Char = character.semicolon
#If DEBUG Then
    Public Const defaultServerUrl As String = "http://oc.hzj-jie.net:800/"
#Else
    Public Const defaultServerUrl As String = "http://oc.hzj-jie.net/"
#End If

    Public Function isSharedCookieSite(ByVal site As String) As Boolean
        Return strsame(sharedCookieSite, site)
    End Function
End Module
